#ifndef __ADC_H
#define __ADC_H
#include "main.h"
void SysAdcInitial(void);
void HAL_ADC_MspInit(ADC_HandleTypeDef* hadc);
void HAL_ADC_MspDeInit(ADC_HandleTypeDef* hadc);
void DMAXferCpltCallback(struct __DMA_HandleTypeDef *hdma);
void DMAXferHalfCpltCallback(struct __DMA_HandleTypeDef *hdma);
void DMAXferErrorCallback(struct __DMA_HandleTypeDef *hdma);
void DMAXferAbortCallback(struct __DMA_HandleTypeDef *hdma);
void Output_AdcVal(void);

#if 0
void BSP_Configuration(void);
void MX_DMA_Init(void);
void DMA_ADC_Demo2(void);
#endif
void StartAdc(void);

void Output_AdcVal(void);
extern	uint8	AdcDone_Time;
#define	Max_Adc_Time   64

typedef struct
{
   uint16 Tb;   
   uint16 Tc;  
   uint16 Td;  
   uint16 Ua;  
   uint16 Uc;  
   uint16 Ub;  
   uint16 Iabc;  
   uint16 Ia;  
   uint16 Ib;  
   uint16 Ic;  
   uint16 Ta;  
   uint16 Vr;                        
}SampledData;
typedef struct
{
   uint16 Ua_max;
   uint16 Ua_min;
   uint32 Ua_EffectiveValue;
   uint32 Ua_Effective;
   
   uint16 Ub_max;
   uint16 Ub_min;
   uint32 Ub_EffectiveValue;  
   uint32 Ub_Effective;

   uint16 Uc_max;
   uint16 Uc_min;
   uint32 Uc_EffectiveValue; 
   uint32 Uc_Effective;  

   int16 Ta_average;
   int16 Tb_average;
   int16 Tc_average;
   int16 Td_average;

   uint16 Ia_max;
   uint16 Ia_min;
   uint32 Ia_EffectiveValue; 
   uint32 Ia_Effective; 

   uint16 Ib_max;
   uint16 Ib_min;
   uint32 Ib_EffectiveValue;     
   uint32 Ib_Effective;

   uint16 Ic_max;
   uint16 Ic_min;
   uint32 Ic_EffectiveValue; 
   uint32 Ic_Effective; 

	uint16 Iabc_max;
	uint16 Iabc_min;
	uint32 Iabc_EffectiveValue; 
	uint32 Iabc_Effective; 

   
}SampledDataAnalysis;

extern ADC_HandleTypeDef Hadc;
#define		FixedResistanceValue	10000	
#define 	ADCChanleNumber 		12
extern		SampledData __align(32) AdcValBuf[Max_Adc_Time];
extern		uint16	VREFINT_CAL;
#endif
